import { ref, computed } from 'vue';
import { defineStore } from 'pinia';

export const userStore = defineStore({
	id: 'user',
	state: () => {
		return {
			nicknum: 0,
			nickname: '小李',
			nickage: 20
		};
	},
	getters: {
		changeAge() {
			console.log('getters');
			return this.num + 10;
		}
	},
	actions: {
		upAge(val) {
			this.num = val;
		}
	},

	//开启数据缓存(pinia)
	persist: {
		enabled: true
	}
});
